home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Just Call Me Internet
/
Just Call Me Internet.iso
/
prog
/
atari
/
c
/
du_lib
/
windial.c
< prev
Wrap
C/C++ Source or Header
|
1995-07-10
|
21KB
|
868 lines
/*
DU_LIB v2
Gem Window Management & Dialog Library For Lattice C
½1994, by Craig Graham.
Based on the DU_LIBv1 Library for HiSoft Basic.
*/
/*
Windowed Dialog Handlers
*/
#include "dulib.h"
#ifndef cg_graf_watchbox
short cg_graf_watchbox(OBJECT *dial, short ob, short i, short o);
#endif
short called_from_process_win_dial=FALSE;
GRECT button_clip;
GRECT button_dclip;
/*==========================================
= Open a non-blocking dialog in a window =
= ½21/8/1994, Craig Graham =
===========================================*/
short activate_dialog(short dialog, char *n, dialog_type t)
{
OBJECT *a;
short x,y,rx,ry,rw,rh;
short sx,sy,sw,sh;
short wh,tp;
Wtype wt;
/* Is tool bar already open ? - if so, then top it. */
x=-1;
for (y=0; y<max_windows;y++)
{
if ((((windows[y].window_type==wt_dialog)
||(windows[y].window_type==wt_dialog_side_bar))
||(windows[y].window_type==wt_dialog_bottom_bar))
&&(windows[y].the_dialog==dialog))
{
x=y;
}
}
wind_get(0,WF_WORKXYWH,&sx,&sy,&sw,&sh);
if (x!=-1)
{
wind_set(x,WF_TOP,0,0,0,0);
return 1;
}else{
/* Get size of dialog */
rsrc_gaddr(0,dialog,&a);
rx=ry=rw=rh=0;
wt=wt_dialog;
/*Open the window*/
switch (t)
{
case DIAL_FIXED:
tp=NAME;
wt=wt_static_menu;
break;
case DIAL_NO_CLOSE:
tp=NAME+MOVER;
wt=wt_dialog;
break;
case DIAL_WIDGET_BAR:
tp=NAME+CLOSER+FULLER+MOVER+SIZER+UPARROW+DNARROW+VSLIDE+LFARROW+RTARROW+HSLIDE+SMALLER;
wt=wt_drawing;
break;
case DIAL_ROLLUP_SIDE_SCROLLER:
tp=NAME+CLOSER+FULLER+MOVER+UPARROW+DNARROW+VSLIDE+SMALLER;
wt=wt_dialog_side_bar;
break;
case DIAL_ROLLUP_BOTTOM_SCROLLER:
tp=NAME+CLOSER+FULLER+MOVER+LFARROW+RTARROW+HSLIDE+SMALLER;
wt=wt_dialog_bottom_bar;
break;
case DIAL_ROLLUP:
tp=NAME+CLOSER+FULLER+MOVER+SMALLER;
wt=wt_dialog;
break;
}
form_center(a,&rx,&ry,&rw,&rh);
wind_calc(0,tp,rx,ry,rw,rh,&rx,&ry,&rw,&rh);
if ((rx+rw)>(sx+sw))
{
rx=sx; rw=sw;
}
if ((ry+rh)>(sy+sh))
{
ry=sy; rh=sh;
}
wh=wind_create(tp,rx,ry,rw,rh);
if (wh)
{
wind_set(wh,WF_NAME, ADDR(n));
wind_open(wh,rx,ry,rw,rh);
windows[wh].window_type=wt;
windows[wh].the_dialog=dialog;
windows[wh].redraw_mode=wrm_window;
udw=0;
display_dial(wh);
last_opened_window=wh;
}
}
return wh;
}
/*==============================
Close all copies of a Dialog
==============================*/
short close_dialog(short dialog)
{
short y;
/* Is dialog open ? - if so, then close it. */
for (y=0; y<max_windows;y++)
if ((windows[y].window_type!=wt_null) && (windows[y].the_dialog==dialog))
close_dialog_window(y);
return 0;
}
/*==============================
Close a Dialog Window
==============================*/
short close_dialog_window(short e_wind)
{
windows[e_wind].the_dialog=0;
windows[e_wind].window_type=wt_null;
graf_mouse(M_OFF,NULL);
wind_close(e_wind);
wind_delete(e_wind);
graf_mouse(M_ON,NULL);
return 0;
}
short set_window_title(short h, char *a)
{
wind_set(h,WF_NAME,ADDR(a));
return 0;
}
/*===========================================
= Display a win_dialog window (clipped) =
===========================================*/
short display_dial(short wind_handle)
{
short x,y,w,h;
short rw,rh,dialog,rx,ry;
short dx,dy,dw,dh;
short cb,top_wind;
OBJECT *a;
cb=wmi_total_buffering;
wmi_total_buffering=0;
dx=dy=dw=dh=0;
/* vst_point(12);*/
dialog=windows[wind_handle].the_dialog;
rsrc_gaddr(0,dialog,&a);
wind_get(wind_handle,WF_WORKXYWH,&x,&y,&w,&h);
if (h!=0)
{
wind_get(wind_handle,WF_TOP,&top_wind,0,0,0);
a->ob_x=x;
a->ob_y=y;
graf_mouse(M_OFF,NULL);
wind_update(BEG_UPDATE);
if (wind_handle==top_wind)
{
cr_dclip.g_x=x;
cr_dclip.g_y=y;
cr_dclip.g_w=w;
cr_dclip.g_h=h;
objc_draw(a,0,5,x,y,w,h);
redraw_custom(wind_handle);
}else{
wind_get(wind_handle,WF_FIRSTXYWH,&rx,&ry,&rw,&rh);
while (rw>0 && rh>0)
{
dx=rx;dy=ry;dw=rw;dh=rh;
if (udw!=0)
{
if (intersection(rx,ry,rw,rh,udx,udy,udw,udh,&dx,&dy,&dw,&dh))
{
cr_dclip.g_x=dx;
cr_dclip.g_y=dy;
cr_dclip.g_w=dw;
cr_dclip.g_h=dh;
objc_draw(a,0,5,dx,dy,dw,dh);
redraw_custom(wind_handle);
}
}
wind_get(wind_handle,WF_NEXTXYWH,&rx,&ry,&rw,&rh);
}
}
wind_update(END_UPDATE);
graf_mouse(M_ON,NULL);
}
wmi_total_buffering=cb;
return 0;
}
/*=========================================================================
= Re-display only the custom objects in a win_dialog window (clipped) =
=========================================================================*/
short custom_display_dial(short wind_handle)
{
short wx,wy,ww,wh;
short rw,rh,dialog,rx,ry;
short dx,dy,dw,dh;
short cb;
OBJECT *a;
short clip[4];
CallBack rd;
Elist *e;
GRECT r;
#ifdef __USE_GNU
short x,y;
#endif
cb=wmi_total_buffering;
wmi_total_buffering=0;
dx=dy=dw=dh=0;
dialog=windows[wind_handle].the_dialog;
this_dialog=dialog;
cr_wind_handle=wind_handle;
rsrc_gaddr(0,dialog,&a);
wind_get(wind_handle,WF_WORKXYWH,&wx,&wy,&ww,&wh);
if (wh!=0)
{
a->ob_x=wx;
a->ob_y=wy;
graf_mouse(M_OFF,NULL);
wind_update(BEG_UPDATE);
wind_get(wind_handle,WF_FIRSTXYWH,&rx,&ry,&rw,&rh);
while (rw>0 && rh>0)
{
dx=rx;dy=ry;dw=rw;dh=rh;
if (udw!=0)
{
if (intersection(rx,ry,rw,rh,udx,udy,udw,udh,&dx,&dy,&dw,&dh))
{
cr_dclip.g_x=dx;
cr_dclip.g_y=dy;
cr_dclip.g_w=dw;
cr_dclip.g_h=dh;
r=cr_dclip;
e=event_value[dialog];
if (e!=0)
{
for(; e!=0; e=e->next)
{
rd=e->redraw;
if (rd)
{
this_ob=e->object;
#ifndef __USE_GNU
objc_xywh(a,this_ob,&cr_clip);
cr_clip.g_w--;
cr_clip.g_h--;
#else
objc_offset(a,this_ob,&x,&y);
cr_clip.g_x=x;
cr_clip.g_y=y;
cr_clip.g_w=(a+this_ob)->ob_width;
cr_clip.g_h=(a+this_ob)->ob_height;
#endif
cr_dclip=r;
if (rc_intersect(&cr_clip,&cr_dclip))
{
clip[0]=cr_dclip.g_x; clip[1]=cr_dclip.g_y;
clip[2]=cr_dclip.g_x+cr_dclip.g_w-1; clip[3]=cr_dclip.g_y+cr_dclip.g_h-1;
vs_clip(x_handle,1,clip);
objc_draw(a,this_ob,1,dx,dy,dw,dh);
(*rd)();
}
}
}
}
}
}
wind_get(wind_handle,WF_NEXTXYWH,&rx,&ry,&rw,&rh);
}
wind_update(END_UPDATE);
graf_mouse(M_ON,NULL);
}
wmi_total_buffering=cb;
return 0;
}
/*=========================================================================
= Re-display only a specified object in a win_dialog window (clipped) =
=========================================================================*/
short wind_display_object(short wind_handle, short object)
{
short wx,wy,ww,wh;
short rw,rh,dialog,rx,ry;
short dx,dy,dw,dh;
short cb;
OBJECT *a;
short clip[4];
CallBack rd;
GRECT r;
#ifdef __USE_GNU
short x,y;
#endif
cb=wmi_total_buffering;
wmi_total_buffering=0;
dx=dy=dw=dh=0;
dialog=windows[wind_handle].the_dialog;
this_dialog=dialog;
this_ob=object;
cr_wind_handle=wind_handle;
rsrc_gaddr(0,dialog,&a);
wind_get(wind_handle,WF_WORKXYWH,&wx,&wy,&ww,&wh);
if (wh!=0)
{
a->ob_x=wx;
a->ob_y=wy;
rd=Get_object_redraw(dialog, object);
graf_mouse(M_OFF,NULL);
wind_update(BEG_UPDATE);
wind_get(wind_handle,WF_FIRSTXYWH,&rx,&ry,&rw,&rh);
while (rw>0 && rh>0)
{
dx=rx;dy=ry;dw=rw;dh=rh;
if (intersection(rx,ry,rw,rh,scrn_x,scrn_y,scrn_w,scrn_h,&dx,&dy,&dw,&dh))
{
cr_dclip.g_x=dx;
cr_dclip.g_y=dy;
cr_dclip.g_w=dw;
cr_dclip.g_h=dh;
r=cr_dclip;
#ifndef __USE_GNU
objc_xywh(a,this_ob,&cr_clip);
cr_clip.g_w--;
cr_clip.g_h--;
#else
objc_offset(a,this_ob,&x,&y);
cr_clip.g_x=x;
cr_clip.g_y=y;
cr_clip.g_w=(a+this_ob)->ob_width;
cr_clip.g_h=(a+this_ob)->ob_height;
#endif
cr_dclip=r;
if (rc_intersect(&cr_clip,&cr_dclip))
{
clip[0]=cr_dclip.g_x; clip[1]=cr_dclip.g_y;
clip[2]=cr_dclip.g_x+cr_dclip.g_w-1; clip[3]=cr_dclip.g_y+cr_dclip.g_h-1;
vs_clip(x_handle,1,clip);
if (called_from_process_win_dial)
objc_draw(a,this_ob,1,rx,ry,rw,rh);
else
objc_draw(a,this_ob,1,cr_dclip.g_x,cr_dclip.g_y,cr_dclip.g_w,cr_dclip.g_h);
if (rd) /*If a custom redraw exists, use it*/
(*rd)();
}
}
wind_get(wind_handle,WF_NEXTXYWH,&rx,&ry,&rw,&rh);
}
wind_update(END_UPDATE);
graf_mouse(M_ON,NULL);
}
wmi_total_buffering=cb;
return 0;
}
/*====================================================================================
= Re-display only the a specified custom object in a win_dialog window (clipped) =
====================================================================================*/
short custom_display_object(short wind_handle, short ob)
{
wind_display_object(wind_handle, ob);
return 0;
}
int intersection(short x1,short y1,short w1,short h1,short x2,short y2,short w2,short h2,short *x,short *y,short *w,short *h)
{
GRECT a,b;
int r;
a.g_x=x2; a.g_y=y2; a.g_w=w2; a.g_h=h2;
b.g_x=x1; b.g_y=y1; b.g_w=w1; b.g_h=h1;
r=rc_intersect(&a,&b);
*x=b.g_x; *y=b.g_y; *w=b.g_w; *h=b.g_h;
return r;
}
/* Update a dialog (if it is open)*/
short dialog_update(short d)
{
short n,rtn;
rtn=0;
for(n=0; n<max_windows; n++)
{
if ((windows[n].window_type!=wt_null)&&(windows[n].the_dialog==d))
{
rtn=update_window(n);
}
}
return rtn;
}
short dialog_display(short d)
{
short n,rtn;
rtn=0;
udx=scrn_x; udy=scrn_y; udw=scrn_w; udh=scrn_h;
for(n=0; n<max_windows; n++)
{
if ((windows[n].window_type!=wt_null)&&(windows[n].the_dialog==d))
{
rtn=display_dial(n);
}
}
return rtn;
}
short dialog_object_display(short d, short o)
{
short n,rtn;
rtn=0;
udx=scrn_x; udy=scrn_y; udw=scrn_w; udh=scrn_h;
for(n=0; n<max_windows; n++)
{
if ((windows[n].window_type!=wt_null)&&(windows[n].the_dialog==d))
{
rtn=wind_display_object(n,o);
}
}
return rtn;
}
int redraw_custom(short wind_handle)
{
OBJECT *a;
short clip[4];
CallBack rd;
short dialog;
Elist *e;
GRECT r;
#ifdef __USE_GNU
short x,y;
#endif
dialog=windows[wind_handle].the_dialog;
rsrc_gaddr(0,dialog,&a);
this_dialog=dialog;
cr_wind_handle=wind_handle;
r=cr_dclip;
e=event_value[dialog];
if (e!=0)
{
for(; e!=0; e=e->next)
{
rd=e->redraw;
if (rd)
{
this_ob=e->object;
#ifndef __USE_GNU
objc_xywh(a,this_ob,&cr_clip);
cr_clip.g_w--;
cr_clip.g_h--;
#else
objc_offset(a,this_ob,&x,&y);
cr_clip.g_x=x;
cr_clip.g_y=y;
cr_clip.g_w=(a+this_ob)->ob_width;
cr_clip.g_h=(a+this_ob)->ob_height;
#endif
cr_dclip=r;
if (rc_intersect(&cr_clip,&cr_dclip))
{
clip[0]=cr_dclip.g_x; clip[1]=cr_dclip.g_y;
clip[2]=cr_dclip.g_x+cr_dclip.g_w-1; clip[3]=cr_dclip.g_y+cr_dclip.g_h-1;
vs_clip(x_handle,1,clip);
(*rd)();
}
}
}
}
return 0;
}
/*==================================================================
= Perform processing on a dialog in a window. =
= When passed an MU_BUTTON event for a dialog window, this =
= will perfrom processing on that dialog (radio buttons, etc) =
= and will return 0 if the dialog did NOT exit, else the object =
= number exitted on. =
==================================================================*/
short process_win_dial(short wh,short x,short y)
{
short ob,mb,Obflags,dx,dy,wdx,wdy,wdw,wdh;
short a,rtn,ReallySelected;
short obx,oby,obw,obh;
short clip[4];
OBJECT *TheDial;
OBJECT *TheObject;
Elist *ipopup_scan;
CallBack custom_handler;
CallBack dcustom_handler;
CallBack rd;
#ifdef __USE_GNU
short cx,cy;
#endif
called_from_process_win_dial=TRUE; /* Use button_clip for redrawing buttons instead of
cr_clipd to ensure 3D buttons work properly*/
rtn=0; mb=0;
a=windows[wh].the_dialog;
this_dialog=a;
cr_wind_handle=wh;
rsrc_gaddr(0,a,&TheDial); /*Address of dialog in resource*/
wind_get(wh,WF_WORKXYWH,&wdx,&wdy,&wdw,&wdh); /*Ensure that the dialog is where we think it is */
dx=wdx; dy=wdy;
TheDial->ob_x=dx; /* (fix for multiple copies of a dialog (eg a widget bar) */
TheDial->ob_y=dy;
ob=objc_find(TheDial, 0, 5, x, y); /*Find the object clicked on*/
if (ob>0)
{
TheObject=TheDial+ob;
custom_handler=Get_object_callback(a, ob); /*Check for a custom object handler (single click)*/
dcustom_handler=Get_object_dcallback(a, ob); /*Check for a custom object handler (double click)*/
rd=Get_object_redraw(a,ob);
this_ob=ob;
#ifndef __USE_GNU
objc_xywh(TheDial,this_ob,&cr_clip);
cr_clip.g_w--;
cr_clip.g_h--;
obx=cr_clip.g_x;
oby=cr_clip.g_y;
obw=cr_clip.g_w;
obh=cr_clip.g_h;
#else
objc_offset(TheDial,this_ob,&cx,&cy);
obx=cr_clip.g_x=cx;
oby=cr_clip.g_y=cy;
obw=cr_clip.g_w=(TheDial+this_ob)->ob_width;
obh=cr_clip.g_h=(TheDial+this_ob)->ob_height;
#endif
cr_dclip.g_x=wdx;
cr_dclip.g_y=wdy;
cr_dclip.g_w=wdw;
cr_dclip.g_h=wdh;
cr_mx=x-obx;
cr_my=y-oby;
button_clip=cr_clip;
button_dclip=cr_dclip;
button_clip.g_x-=3;
button_clip.g_y-=3;
button_clip.g_w+=6;
button_clip.g_h+=6;
rc_intersect(&cr_clip,&cr_dclip);
rc_intersect(&button_clip,&button_dclip);
clip[0]=cr_dclip.g_x; clip[1]=cr_dclip.g_y; clip[2]=cr_dclip.g_x+cr_dclip.g_w-1; clip[3]=cr_dclip.g_y+cr_dclip.g_h-1;
vs_clip(x_handle,1,clip);
if (((click_count==1)&&(custom_handler!=NULL))||((click_count==2)&&(dcustom_handler!=NULL))) /*If there is a custom behaviour, use it */
{
if (((TheObject->ob_flags&SELECTABLE)==SELECTABLE)&&((TheObject->ob_state&DISABLED)!=DISABLED)) /* Is this a selectable object ?*/
{
if (click_count==2)
{
ipopup_scan=(Elist*)0;
find_event(this_dialog,this_ob,&ipopup_scan);
if (!(ipopup_scan->popup_form))
TheObject->ob_state=TheObject->ob_state|SELECTED;
}else{
TheObject->ob_state=TheObject->ob_state|SELECTED;
}
if ((TheObject->ob_state|SELECTED)) /* Don't select icon popups when they are double clicked on */
{
graf_mouse(M_OFF,NULL); /* Display object as selected */
objc_draw(TheDial,ob,1,button_dclip.g_x,button_dclip.g_y,button_dclip.g_w,button_dclip.g_h);
if (rd) (*rd)();
graf_mouse(M_ON,NULL);
}
}
clip[0]=cr_dclip.g_x; clip[1]=cr_dclip.g_y; clip[2]=cr_dclip.g_x+cr_dclip.g_w-1; clip[3]=cr_dclip.g_y+cr_dclip.g_h-1;
vs_clip(x_handle,1,clip);
if ((TheObject->ob_state&DISABLED)!=DISABLED)
{
switch(click_count)
{
case 1: /* Single click handler ?*/
if (custom_handler)
{
if ((*custom_handler)()) rtn=ob;
}
break;
case 2: /* Double click handler ?*/
if (dcustom_handler)
{
if ((*dcustom_handler)()) rtn=ob;
}
break;
}
}
}
clip[0]=cr_dclip.g_x; clip[1]=cr_dclip.g_y; clip[2]=cr_dclip.g_x+cr_dclip.g_w-1; clip[3]=cr_dclip.g_y+cr_dclip.g_h-1;
vs_clip(x_handle,1,clip);
Obflags=TheObject->ob_flags;
if ((click_count==1)&&((Obflags&DISABLED)!=DISABLED))
{
if (!rtn) /* Default behaviour if no custom behaviours have worked */
{
if ((TheObject->ob_flags&SELECTABLE)==SELECTABLE) /* Is this a selectable object ?*/
{
TheObject->ob_state=TheObject->ob_state^SELECTED;
graf_mkstate(&junk,&junk,&mb,&junk);
ReallySelected=cg_graf_watchbox(TheDial,ob,TheObject->ob_state,TheObject->ob_state^SELECTED);
if (!ReallySelected)
if ((TheObject->ob_flags&EXIT)==EXIT) Obflags=0;
else
rtn=ob;
}
}else{
ReallySelected=TRUE;
}
/* Do radio button behaviour if required, but only for a single click */
if ((ReallySelected)&&((TheObject->ob_flags&RBUTTON)==RBUTTON))
{
Radio_b(TheDial,ob);
for(mb=1; mb;) graf_mkstate(&junk,&junk,&mb,&junk);
rtn=ob; /* Radio buttons always return their event */
}
}
clip[0]=cr_dclip.g_x; clip[1]=cr_dclip.g_y; clip[2]=cr_dclip.g_x+cr_dclip.g_w-1; clip[3]=cr_dclip.g_y+cr_dclip.g_h-1;
vs_clip(x_handle,1,clip);
graf_mouse(M_OFF,NULL);
if ((Obflags&EXIT)==EXIT) /* Exit buttons are always reset & redrawn, no matter what was returned */
{
if ((TheObject->ob_flags&RBUTTON)==0)
{
TheObject->ob_state=TheObject->ob_state&~SELECTED;
objc_draw(TheDial,ob,1,button_dclip.g_x,button_dclip.g_y,button_dclip.g_w,button_dclip.g_h);
if (rd) (*rd)();
}
rtn=ob;
}else{ /* Custom click handlers may have returned a value - if TRUE then a redraw was requested */
if ((rtn)&&((custom_handler)||(dcustom_handler)))
{
objc_draw(TheDial,ob,1,button_dclip.g_x,button_dclip.g_y,button_dclip.g_w,button_dclip.g_h);
if (rd) (*rd)();
}
}
graf_mouse(M_ON,NULL);
}
called_from_process_win_dial=FALSE;
return rtn;
}
/*
Sets one of a group of radio buttons, and clears the rest.
Includes patch to allow for pop_icons as radio buttons.
*/
short Radio_b(OBJECT *d, short object)
{
OBJECT *obloc;
short m,parent,o,tobs;
parent=GetParent(d,object);
tobs=this_ob;
obloc=d+parent;
udx=scrn_x; udy=scrn_y;
udw=scrn_w; udh=scrn_h;
o=obloc->ob_head;
obloc=d+o;
while ((o!=parent)&&(o!=-1))
{
if (((obloc->ob_flags&RBUTTON)==RBUTTON)&&((obloc->ob_state&SELECTED)==SELECTED))
{
obloc->ob_state=(obloc->ob_state)&~SELECTED;
for(m=0; m<max_windows; m++)
if ((windows[m].window_type!=wt_null)&&(windows[m].the_dialog==this_dialog))
custom_display_object(m,o);
}
o=obloc->ob_next;
obloc=d+o;
}
obloc=d+object;
obloc->ob_state=(obloc->ob_state)|SELECTED;
for(m=0; m<max_windows; m++)
if ((windows[m].window_type!=wt_null)&&(windows[m].the_dialog==this_dialog))
custom_display_object(m,object);
this_ob=tobs;
return 0;
}
/* Returns the object number of this object's parent or -1 if it is the root*/
short GetParent(OBJECT *t,short object)
{
short nextobject,n_ob_tail;
OBJECT* c_obl;
OBJECT* n_obl;
if (object==0)
{
return -1;
} else {
do
{
c_obl=t+object;
nextobject=c_obl->ob_next;
n_obl=t+nextobject;
n_ob_tail=n_obl->ob_tail;
if (n_ob_tail!=object) { object=nextobject; }
}
while (n_ob_tail!=object);
return nextobject;
}
}
/* Returns the value of the ob_state,ob_type & ob_flags fields in the given object */
short Get_ob_info(OBJECT *dialog,short ob,short *otype,short *oflags,short *ostate)
{
OBJECT *a;
a=dialog+ob;
*oflags=a->ob_flags;
*otype=a->ob_type;
*ostate=a->ob_state;
return 0;
}
/*
Replacement for graf_watchbox() that does justice to colour icons and 3d objects
17/5/95
*/
short cg_graf_watchbox(OBJECT *dial, short ob, short i, short o)
{
short pobf,obf,mx,my,mb,e,x,y,w,h;
graf_mkstate(&mx,&my,&mb,&junk);
objc_offset(dial,ob,&x,&y);
w=(dial+ob)->ob_width+2;
h=(dial+ob)->ob_height+2;
x--; y--;
if (!mb) // If mouse button is already released, assume that was just a click, so select
{
(dial+ob)->ob_state=i;
graf_mouse(M_OFF,NULL);
if (called_from_process_win_dial)
objc_draw(dial,ob,1,button_dclip.g_x,button_dclip.g_y,button_dclip.g_w,button_dclip.g_h);
else
objc_draw(dial,ob,1,x,y,w,h);
graf_mouse(M_ON,NULL);
return TRUE;
}
wind_update(BEG_UPDATE);
wind_update(BEG_MCTRL);
pobf=-2;
while (mb)
{
#ifndef __USE_GNU
e=evnt_multi(MU_BUTTON|MU_M1|MU_TIMER, 1, 1, 1, 1, mx, my, 1, 1,0,0,0,0,0,
messB,100,0,&mx,&my,&mb,&junk,&junk,&junk);
#else
e=evnt_multi(MU_BUTTON|MU_M1|MU_TIMER, 1, 1, 1, 1,mx,my,1,1,0,0,0,0,0,
messB,100,&mx,&my,&mb,&junk,&junk,&junk);
#endif
if (!(e&MU_BUTTON)) graf_mkstate(&mx,&my,&mb,&junk);
obf=objc_find(dial,ob,1,mx,my);
if (obf==ob)
(dial+ob)->ob_state=i;
else
(dial+ob)->ob_state=o;
if (pobf!=obf)
{
pobf=obf;
graf_mouse(M_OFF,NULL);
if (called_from_process_win_dial)
objc_draw(dial,ob,1,button_dclip.g_x,button_dclip.g_y,button_dclip.g_w,button_dclip.g_h);
else
objc_draw(dial,ob,1,x,y,w,h);
graf_mouse(M_ON,NULL);
}
}
wind_update(END_MCTRL);
wind_update(END_UPDATE);
if (obf==ob)
return 1;
else
return 0;
}